{# Pieces shared by Overseer pages. #} {% from "components/macros/layout.html" import card, chart_panel, facts, health_badge %} {% from "components/macros/form.html" import range_form %} {# A page's live charts (``overseer_live.chart_panel``): the range chips, which re-request ``target`` at ``url`` over the new window (its stream follows), then the charts, two across. #} {% macro live_charts(panel, target, url) %} {% if panel.charts %} {{ range_form(panel.windows, panel.window, url, target, field="window", aria="Chart window", class="mt-4 flex justify-end") }}
{% for chart in panel.charts %} {{ chart_panel(chart.id, chart.title, "line", chart.data, subtitle=chart.subtitle, live=True, empty=chart.empty) }} {% endfor %}
{% endif %} {% endmacro %} {# An HTTP verb, set in the mono label voice. #} {% macro method_tag(method) %} {{ method }} {% endmacro %} {# The "Current status" card every component page shows. ``extra`` rows go between the health check and the registered name. #} {% macro status_card(component, name, extra=[]) %} {% call card("Current status") %} {{ facts([("State", health_badge(component.status.value)), ("Health check", "%.1f ms"|format(component.response_time_ms) if component.response_time_ms is not none else none)] + extra + [("Registered as", name)]) }} {% endcall %} {% endmacro %} {# A column's cell renderer for data_table: a row's HTTP method(s). #} {% macro method_cell(value) %}{% for method in (value if value is not string else [value]) %}{{ method_tag(method) }}{% endfor %}{% endmacro %} {# A line of the project's source, linked to it in Overseer > Code: ``app/core/storage.py:36`` (``overseer_code.line_url``). #} {% macro line_link(path, line) %}{{ path }}:{{ line }}{% endmacro %} {# A traceback's frame in the app's own code (``overseer_code.own_frames``). #} {% macro own_frame(frame) %}{{ line_link(frame.path, frame.line) }}{% endmacro %}